Import('RTT_ROOT')
Import('EXT_ROOT')
Import('APP_ROOT')
Import('BSP_ROOT')
from building import *

cwd  = GetCurrentDir()
objs = []
#list = os.listdir(cwd)	

# contain startup obj under root.
objs += SConscript(os.path.join('startup', 'SConscript'))
# contain applications obj.
if os.path.normpath(APP_ROOT) == cwd:
    src = ['startup/application.c']
    objs += DefineGroup('applications', src, depend = [''])
else:
    objs += SConscript(os.path.join(APP_ROOT, 'SConscript'),
        					   variant_dir='applications',
        					   duplicate=0)	
		   
# contain bsp drivers obj.
list = ['drivers', 'pcap']
for d in list:
    path = os.path.join(BSP_ROOT, d)
    if os.path.isfile(os.path.join(path, 'SConscript')):
        objs += SConscript(os.path.join(path, 'SConscript'))
	
# contain components obj.
if GetDepend('RT_USING_RTGUI'):
    if EXT_ROOT:	
        objs += SConscript(EXT_ROOT + '/rtgui/SConscript',
        					   variant_dir='components/rtgui',
        					   duplicate=0)
    else:
        objs += SConscript(os.path.join(RTT_ROOT + '/components/rtgui', 'SConscript'))
		
if GetDepend('RT_USING_MXML'):
    if EXT_ROOT:
        objs += SConscript(EXT_ROOT + '/mxml/SConscript',
							   variant_dir='components/mxml',
							   duplicate=0)	
    else:
        objs += SConscript(os.path.join(RTT_ROOT + '/components/mxml', 'SConscript'))

	

if GetDepend('RT_USING_TC'):
    objs += SConscript(RTT_ROOT + '/examples/kernel/SConscript', 
    					    variant_dir  = 'tc/kernel',
    					    duplicate=0)

Return('objs')
